package system.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import framework.utils.JsonUtil;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class JsonUtilConfig implements InitializingBean {
    private final ObjectMapper objectMapper;

    public JsonUtilConfig(ObjectMapper objectMapper) {
        this.objectMapper = objectMapper;
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        // set json util to spring json
        JsonUtil.mapper = this.objectMapper;
    }
}
